using Framework;
using UnityEngine;

public class SafeAreaModifier : IScreenSafeAreaModifier
{
    private GUIConfig config;
    public SafeAreaModifier(GUIConfig config)
    {
        this.config = config;
    }
    public Rect Modify(Rect safeArea, ScreenOrientation orientation, Vector2 canvasSize)
    {
        GameEntry.GUI.ScreenInfo.AdjustScreenSize();
        config.Mask.anchoredPosition = new Vector2(0, -GameEntry.GUI.ScreenInfo.YOffset);
        return safeArea;
        /*
        Debug.LogError(orientation + ":" + canvasSize);
        if (orientation == ScreenOrientation.Portrait)
        {
            var rect = new Rect(safeArea);
            rect.xMin += 50;
            return rect;
        }
        else if (orientation == ScreenOrientation.LandscapeRight)
        {
            var rect = new Rect(safeArea);
            if (rect.xMin > 0f)
            {
                rect.xMin += 100;
            }
            if (rect.xMax < canvasSize.x)
            {
                rect.xMax -= 100;
            }
            return rect;
        }
        else
        {
            var rect = new Rect(safeArea);
            if (rect.xMin > 0f)
            {
                rect.xMin += 50;
            }
            if (rect.xMax < canvasSize.x)
            {
                rect.xMax -= 100;
            }
            return rect;
        }
        */
    }
}